//
//  Selection_RecommCell.m
//  LoveTravel
//
//  Created by MS on 16-1-20.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "Selection_RecommCell.h"
#import "UIImageView+WebCache.h"
@interface Selection_RecommCell ()

@property (weak, nonatomic) IBOutlet UIImageView *userImageView;
@property (weak, nonatomic) IBOutlet UILabel *userNameView;
@property (weak, nonatomic) IBOutlet UILabel *userDescView;
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleView;
@property (weak, nonatomic) IBOutlet UILabel *subTitleView;
@property (weak, nonatomic) IBOutlet UILabel *textView;
@property (weak, nonatomic) IBOutlet UILabel *locationView;
@property (weak, nonatomic) IBOutlet UILabel *likeCountView;

@property (weak, nonatomic) IBOutlet UIView *bottonLineView;
@property (weak, nonatomic) IBOutlet UIView *topLineView;

@end

@implementation Selection_RecommCell



-(void)setRecomData:(RecommsData *)recomData
{
    _recomData = recomData;
    [_userImageView sd_setImageWithURL:[NSURL URLWithString:recomData.referrer.photo_url]];
    _userNameView.text = recomData.referrer.username;
    _userDescView.text = recomData.referrer.intro;
    
    [_bgImageView sd_setImageWithURL:[NSURL URLWithString:recomData.bg_pic[0]]];
    _titleView.text = recomData.title;
    _subTitleView.text = recomData.sub_title;
    
    _locationView.text = recomData.destination;
    _likeCountView.text =[NSString stringWithFormat:@"%ld",(long)recomData.like_count];
    _textView.text = recomData.short_desc;
    
//    设置label行距
//    NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:recomData.short_desc];
//    NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
//    [paragraphStyle1 setLineSpacing:3];
//    [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [recomData.short_desc length])];
//    [_textView setAttributedText:recomData.short_descAttribute];
  
}

-(void)awakeFromNib
{
    _bgImageView.clipsToBounds = YES;
    _userImageView.layer.cornerRadius = _userImageView.width*0.5;
    _userImageView.clipsToBounds = YES;
    _textView.textColor=[UIColor colorWithRed:0.34f green:0.34f blue:0.41f alpha:1.00f];
    _titleView.font = [UIFont boldSystemFontOfSize:15];
    _subTitleView.font = [UIFont boldSystemFontOfSize:11];
    _bottonLineView.backgroundColor =[UIColor colorWithRed:0.91f green:0.91f blue:0.91f alpha:1.00f];
    _topLineView.backgroundColor =[UIColor colorWithRed:0.91f green:0.91f blue:0.91f alpha:1.00f];
    self.backgroundColor = [UIColor colorWithRed:0.97f green:0.97f blue:0.97f alpha:1.00f];

}

-(void)layoutSubviews
{
    [super layoutSubviews];
    [self.contentView setNeedsLayout];
    [self.contentView layoutIfNeeded];
    
}

@end
